#include "header.h"
#include "./Libs/General.h"
#include "./Libs/Calculation.h"

int main(int argc, char *argv[]) {
  double ***Pray, ***Predator;
  int i,j;
  int x_points, from_point, to_point, mode,ystp;

  ystp = ysteps;
  x_points = xsteps;
  from_point = 1;
  to_point = from_point + x_points - 1;

  Pray = InitializeArray(Pray,x_points);
  Predator = InitializeArray(Predator,x_points);
  GetInitialDistribution(Predator[0],Pray[0],from_point-1,to_point+1);
  Print2dArray(Predator[0], x_points, ystp);

  for(i=1;i<tsteps;++i) {
    for(j=0;j<x_points+2;++j) {
      Predator[i][0][j] = Predator[i-1][0][j];
      Predator[i][ystp-1][j] = Predator[i-1][ystp-1][j];
      Pray[i][0][j] = Pray[i-1][0][j];
      Pray[i][ystp-1][j] = Pray[i-1][ystp-1][j];
    }
    for(j=0;j<ysteps;++j) {
      Predator[i][j][0] = Predator[i-1][j][0];
      Predator[i][j][x_points+1] = Predator[i-1][j][x_points+1];
      Pray[i][j][0] = Pray[i-1][j][0];
      Pray[i][j][x_points+1] = Pray[i-1][j][x_points+1];
    }
    GetNextIteration(Predator[i-1],Pray[i-1],Predator[i],Pray[i],from_point,to_point);
    //Print2dArray(Predator[i-1], x_points, ystp);
    //Print2dArray(Predator[i], x_points, ystp);
  }
/*
  printf("rank is %d, x_points is %d,from_point is %d\n",rank,x_points,from_point);
  for(i=0;i<ysteps;++i) {
    for(j=0;j<x_points+2;++j) 
      printf("(%.2f,%.2f)  ",Pray[2999][i][j],Predator[2999][i][j]);
    printf("\n");
  }
  printf("\n");
*/
  SaveResultsToFile(Predator,Pray,0);

  return 0;
}
